package org.scisaga.tetra.test;
import java.io.*;
import java.net.*;

public class Connect {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String serverName = "166.111.59.15";
		
		
		try{
			Socket sock = new Socket(serverName,12357);
			BufferedReader is = new BufferedReader(new InputStreamReader(sock.getInputStream(),"8859_1"));
			PrintWriter os = new PrintWriter(new OutputStreamWriter(sock.getOutputStream(),"8859_1"));
			
			String mesg = "hello!";
			os.print(mesg + "\r\n");
			os.flush();
			String reply = is.readLine();
			System.out.println("Send \"" + mesg + "\"");
			System.out.println("Got \"" + reply + "\"");
			
			mesg = "hello2!";
			os.print(mesg + "\r\n");
			os.flush();
			reply = is.readLine();
			System.out.println("Send \"" + mesg + "\"");
			System.out.println("Got \"" + reply + "\"");
			
			sock.close();
			
		} catch (IOException e){
			System.out.print(e);
		}

	}

}
